package org.jumiz.db.http.handler;

import com.sun.net.httpserver.HttpExchange;
import com.sun.net.httpserver.HttpHandler;
import org.jumiz.db.result.TypeResultZ;
import org.jumiz.db.util.DocDBOnLineUtilZ;

import java.io.IOException;
import java.io.OutputStream;

/**
 *
 */
public class JumiZOnLineHtmlHandler implements HttpHandler {

    @Override
    public void handle(HttpExchange exchange) throws IOException {
        String response = "{\"error\":\"error\"}";
        try {
            response = new DocDBOnLineUtilZ().doc(TypeResultZ.HTML);
//            exchange.getResponseHeaders().add("Content-Type", "application/json; charset=UTF-8");
            exchange.sendResponseHeaders(200, 0);
        } catch (Exception e) {
            e.printStackTrace();
        }
        OutputStream os = exchange.getResponseBody();
        os.write(response.getBytes());
        os.close();
    }
}
